package com.jack.xiaoer.entity;

import com.jack.xiaoer.constant.MyConstant;
import org.hibernate.validator.constraints.NotBlank;

import java.time.Instant;

/**
 * Created by Jackaroo Zhang on 2018/12/10.
 */
public class Category {

    private Long id;

    @NotBlank(message = "分类名称不能为空")
    private String name;

    private String description;

    private Long pid;

    private Integer sortOrder;

    private String iconUrl;

    private Integer type;

    private Integer deleted;

    private Instant gmtCreate;

    private Instant gmtModified;

    public boolean deleted() {
        return MyConstant.DELETED.equals(this.deleted);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public Integer getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(Integer sortOrder) {
        this.sortOrder = sortOrder;
    }

    public String getIconUrl() {
        return iconUrl;
    }

    public void setIconUrl(String iconUrl) {
        this.iconUrl = iconUrl;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

    public Instant getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Instant gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Instant getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Instant gmtModified) {
        this.gmtModified = gmtModified;
    }

    @Override
    public String toString() {
        return "Category{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", pid=" + pid +
                ", sortOrder=" + sortOrder +
                ", iconUrl='" + iconUrl + '\'' +
                ", type=" + type +
                ", deleted=" + deleted +
                ", gmtCreate=" + gmtCreate +
                ", gmtModified=" + gmtModified +
                '}';
    }
}
